#include "Fingerprint-protocol.h"

int main(int argc, char const *argv[])
{
	printf("---------1握手信号-------------------\n");
	FingerprintProtocol protocol = FingerprintProtocol::makeHandshakeProtocol();
	protocol.showPacket();

	printf("------------2效验和是否正确----------------\n");
	vector<uint8_t> handShakeAckPacket = {
	    0xEF, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0x07, 0x00, 0x03, 0x00, 0x00, 0x0A};
	FingerprintProtocol handshakeAckProtocol =
	    FingerprintProtocol::formProtocolPacket(handShakeAckPacket);
	handshakeAckProtocol.showPacket();
	cout << "handshake ack packet is error: " << handshakeAckProtocol.isPacketError() << endl;

	printf("----------3指纹图像------------------\n");
	// 指纹图像
	FingerprintProtocol detectImageProtocol = FingerprintProtocol::makeDetectImageProtocol();
	detectImageProtocol.showPacket();

	printf("----------4生成指纹特征码------------------\n");
	// 生成特征码
	FingerprintProtocol imageFeatureProtocol = FingerprintProtocol::makeImageFeatureProtocol(0x01);
	imageFeatureProtocol.showPacket();

	printf("----------5生成模版指令------------------\n");
	FingerprintProtocol imageTemplateProtocol = FingerprintProtocol::makeImageTemplateProtocol();
	imageTemplateProtocol.showPacket();

	printf("----------6存储模版指令------------------\n");
	FingerprintProtocol storeTemplateProtocol = FingerprintProtocol::makeStoreTemplateProtocol(1);
	storeTemplateProtocol.showPacket();

	printf("----------6搜索指纹库------------------\n");
	FingerprintProtocol searchFingerprintProtocol =
	    FingerprintProtocol::makeSearchFingerprintProtocol();
	searchFingerprintProtocol.showPacket();

	printf("----------7删除指纹------------------\n");
	FingerprintProtocol deleteFingerprintProtocol =
	    FingerprintProtocol::makeDeleteFingerprintProtocol(1);
	deleteFingerprintProtocol.showPacket();

	printf("----------8清空指纹------------------\n");
	FingerprintProtocol clearProtocol = FingerprintProtocol::makeClearFingerprintLibProtocol();
	clearProtocol.showPacket();

	printf("-----------9获取packet-------------------------");
	vector<uint8_t> packet = clearProtocol.getPacket();
	for(auto data : packet)
	{
		printf("%02x ", data);
	}
	printf("\n");

	return 0;
}
